﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Drawing;

namespace ParticleEditor
{
    class Particle
    {
        
       public Particle(decimal lifetime, decimal posX, decimal posY)
        {
            totalLife = lifetime;
            PositionX = posX;
            PositionY = posY;
        }

       public Particle(decimal lifetime, decimal posX, decimal posY, decimal velX, decimal velY)
       {
           totalLife = lifetime;
           PositionX = posX;
           PositionY = posY;
           VelocityX = velX;
           VelocityY = velY;
       }

       public void Update(double dt)
       {
           CurrLife += (decimal)dt;
           if (currLife >= TotalLife)
               IsDead = true;

           VelocityX += CPSVelX *   (decimal)dt;
           VelocityY += CPSVelY *   (decimal)dt;
           //CurrColor.A += CPSColA * (decimal)dt;
           //currColor.R += CPSColR * (decimal)dt;
           //currColor.G += CPSColG * (decimal)dt;
           //currColor.B += CPSColB * (decimal)dt;
           Rotation += CPSRot *  (decimal)dt;
           ScaleX += CPSScaleX * (decimal)dt;
           ScaleY += CPSScaleY * (decimal)dt;

           PositionX += VelocityX * (decimal)dt;
           PositionY += VelocityY * (decimal)dt;

       }
      
       private void CalcChangePerSecond()
       {

       }
        private decimal currLife = 0;

        public decimal CurrLife
        {
            get { return currLife; }
            set { currLife = value; }
        }
        private decimal totalLife = 20;

        public decimal TotalLife
        {
            get { return totalLife; }
            set { totalLife = value; }
        }

        private Color currColor = Color.WhiteSmoke;

        public Color CurrColor
        {
            get { return currColor; }
            set { currColor = value; }
        }


        public decimal  CPSVelX  ;
        public decimal  CPSVelY  ;
        public decimal  CPSColA	 ;
        public decimal  CPSColR  ;
        public decimal  CPSColG  ;
        public decimal  CPSColB  ;
        public decimal  CPSRot   ;
        public decimal  CPSScaleX;
        public decimal  CPSScaleY;

        private decimal velocityX = 0;

        public decimal VelocityX
        {
            get { return velocityX; }
            set { velocityX = value; }
        }
        private decimal velocityY = 0;

        public decimal VelocityY
        {
            get { return velocityY; }
            set { velocityY = value; }
        }
        private decimal positionX = 0;

        public decimal PositionX
        {
            get { return positionX; }
            set { positionX = value; }
        }
        private decimal positionY = 0;

        public decimal PositionY
        {
            get { return positionY; }
            set { positionY = value; }
        }

        private decimal rotation = 0;

        public decimal Rotation
        {
            get { return rotation; }
            set { rotation = value; }
        }
        private decimal scaleX = 1;

        public decimal ScaleX
        {
            get { return scaleX; }
            set { scaleX = value; }
        }
        private decimal scaleY = 1;

        public decimal ScaleY
        {
            get { return scaleY; }
            set { scaleY = value; }
        }
        private bool isDead = false;

        public bool IsDead
        {
            get { return isDead; }
            set { isDead = value; }
        }
    }
}
